RNN
keras.engine.base_layer.wrapped_fn()
Base class for recurrent layers.
Arguments
-
cell: A RNN cell instance. A RNN cell is a class that has:
- a
call(input_at_t, states_at_t)
method, returning(output_at_t, states_at_t_plus_1)
. The call method of the cell can also take the optional argumentconstants
, see section "Note on passing external constants" below. - a
state_size
attribute. This can be a single integer (single state) in which case it is the size of the recurrent state (which should be the same as the size of the cell output). This can also be a list/tuple of integers (one size per state). - a
output_size
attribute. This can be a single integer or a TensorShape, which represent the shape of the output. For backward compatible reason, if this attribute is not available for the cell, the value will be inferred by the first element of thestate_size
.
It is also possible for
cell
to be a list of RNN cell instances, in which cases the cells get stacked one after the other in the RNN, implementing an efficient stacked RNN. - a
-
return_sequences: Boolean. Whether to return the last output in the output sequence, or the full sequence.
- return_state: Boolean. Whether to return the last state in addition to the output.
- go_backwards: Boolean (default False). If True, process the input sequence backwards and return the reversed sequence.
- stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.
- unroll: Boolean (default False). If True, the network will be unrolled, else a symbolic loop will be used. Unrolling can speed-up a RNN, although it tends to be more memory-intensive. Unrolling is only suitable for short sequences.
- input_dim: dimensionality of the input (integer).
This argument (or alternatively,
the keyword argument
input_shape
) is required when using this layer as the first layer in a model. - input_length: Length of input sequences, to be specified
when it is constant.
This argument is required if you are going to connect
Flatten
thenDense
layers upstream (without it, the shape of the dense outputs cannot be computed). Note that if the recurrent layer is not the first layer in your model, you would need to specify the input length at the level of the first layer (e.g. via theinput_shape
argument)
Input shape
3D tensor with shape (batch_size, timesteps, input_dim)
.
Output shape
- if
return_state
: a list of tensors. The first tensor is the output. The remaining tensors are the last states, each with shape(batch_size, units)
. For example, the number of state tensors is 1 (for RNN and GRU) or 2 (for LSTM). - if
return_sequences
: 3D tensor with shape(batch_size, timesteps, units)
. - else, 2D tensor with shape
(batch_size, units)
.
Masking
This layer supports masking for input data with a variable number
of timesteps. To introduce masks to your data,
use an Embedding layer with the mask_zero
parameter
set to True
.
Note on using statefulness in RNNs
You can set RNN layers to be 'stateful', which means that the states computed for the samples in one batch will be reused as initial states for the samples in the next batch. This assumes a one-to-one mapping between samples in different successive batches.
To enable statefulness:
- specify stateful=True
in the layer constructor.
- specify a fixed batch size for your model, by passing
if sequential model:
batch_input_shape=(...)
to the first layer in your model.
else for functional model with 1 or more Input layers:
batch_shape=(...)
to all the first layers in your model.
This is the expected shape of your inputs
including the batch size.
It should be a tuple of integers, e.g. (32, 10, 100)
.
- specify shuffle=False
when calling fit().
To reset the states of your model, call .reset_states()
on either
a specific layer, or on your entire model.
Note on specifying the initial state of RNNs
You can specify the initial state of RNN layers symbolically by
calling them with the keyword argument initial_state
. The value of
initial_state
should be a tensor or list of tensors representing
the initial state of the RNN layer.
You can specify the initial state of RNN layers numerically by
calling reset_states
with the keyword argument states
. The value of
states
should be a numpy array or list of numpy arrays representing
the initial state of the RNN layer.
Note on passing external constants to RNNs
You can pass "external" constants to the cell using the constants
keyword argument of RNN.__call__
(as well as RNN.call
) method. This
requires that the cell.call
method accepts the same keyword argument
constants
. Such constants can be used to condition the cell
transformation on additional static inputs (not changing over time),
a.k.a. an attention mechanism.
Examples
# First, let's define a RNN Cell, as a layer subclass.
class MinimalRNNCell(keras.layers.Layer):
def __init__(self, units, **kwargs):
self.units = units
self.state_size = units
super(MinimalRNNCell, self).__init__(**kwargs)
def build(self, input_shape):
self.kernel = self.add_weight(shape=(input_shape[-1], self.units),
initializer='uniform',
name='kernel')
self.recurrent_kernel = self.add_weight(
shape=(self.units, self.units),
initializer='uniform',
name='recurrent_kernel')
self.built = True
def call(self, inputs, states):
prev_output = states[0]
h = K.dot(inputs, self.kernel)
output = h + K.dot(prev_output, self.recurrent_kernel)
return output, [output]
# Let's use this cell in a RNN layer:
cell = MinimalRNNCell(32)
x = keras.Input((None, 5))
layer = RNN(cell)
y = layer(x)
# Here's how to use the cell to build a stacked RNN:
cells = [MinimalRNNCell(32), MinimalRNNCell(64)]
x = keras.Input((None, 5))
layer = RNN(cells)
y = layer(x)
SimpleRNN
keras.layers.SimpleRNN(units, activation='tanh', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0.0, recurrent_dropout=0.0, return_sequences=False, return_state=False, go_backwards=False, stateful=False, unroll=False)
Fully-connected RNN where the output is to be fed back to input.
Arguments
- units: Positive integer, dimensionality of the output space.
- activation: Activation function to use
(see activations).
Default: hyperbolic tangent (
tanh
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - use_bias: Boolean, whether the layer uses a bias vector.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- activity_regularizer: Regularizer function applied to the output of the layer (its "activation"). (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the inputs.
- recurrent_dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the recurrent state.
- return_sequences: Boolean. Whether to return the last output in the output sequence, or the full sequence.
- return_state: Boolean. Whether to return the last state in addition to the output.
- go_backwards: Boolean (default False). If True, process the input sequence backwards and return the reversed sequence.
- stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.
- unroll: Boolean (default False). If True, the network will be unrolled, else a symbolic loop will be used. Unrolling can speed-up a RNN, although it tends to be more memory-intensive. Unrolling is only suitable for short sequences.
GRU
keras.layers.GRU(units, activation='tanh', recurrent_activation='sigmoid', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0.0, recurrent_dropout=0.0, implementation=2, return_sequences=False, return_state=False, go_backwards=False, stateful=False, unroll=False, reset_after=False)
Gated Recurrent Unit - Cho et al. 2014.
There are two variants. The default one is based on 1406.1078v3 and has reset gate applied to hidden state before matrix multiplication. The other one is based on original 1406.1078v1 and has the order reversed.
The second variant is compatible with CuDNNGRU (GPU-only) and allows
inference on CPU. Thus it has separate biases for kernel
and
recurrent_kernel
. Use 'reset_after'=True
and
recurrent_activation='sigmoid'
.
Arguments
- units: Positive integer, dimensionality of the output space.
- activation: Activation function to use
(see activations).
Default: hyperbolic tangent (
tanh
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - recurrent_activation: Activation function to use
for the recurrent step
(see activations).
Default: hard sigmoid (
hard_sigmoid
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - use_bias: Boolean, whether the layer uses a bias vector.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- activity_regularizer: Regularizer function applied to the output of the layer (its "activation"). (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the inputs.
- recurrent_dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the recurrent state.
- implementation: Implementation mode, either 1 or 2. Mode 1 will structure its operations as a larger number of smaller dot products and additions, whereas mode 2 will batch them into fewer, larger operations. These modes will have different performance profiles on different hardware and for different applications.
- return_sequences: Boolean. Whether to return the last output in the output sequence, or the full sequence.
- return_state: Boolean. Whether to return the last state in addition to the output.
- go_backwards: Boolean (default False). If True, process the input sequence backwards and return the reversed sequence.
- stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.
- unroll: Boolean (default False). If True, the network will be unrolled, else a symbolic loop will be used. Unrolling can speed-up a RNN, although it tends to be more memory-intensive. Unrolling is only suitable for short sequences.
- reset_after: GRU convention (whether to apply reset gate after or before matrix multiplication). False = "before" (default), True = "after" (CuDNN compatible).
References
- Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
- On the Properties of Neural Machine Translation: Encoder-Decoder Approaches
- Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling
- A Theoretically Grounded Application of Dropout in Recurrent Neural Networks
LSTM
keras.layers.LSTM(units, activation='tanh', recurrent_activation='sigmoid', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0.0, recurrent_dropout=0.0, implementation=2, return_sequences=False, return_state=False, go_backwards=False, stateful=False, unroll=False)
Long Short-Term Memory layer - Hochreiter 1997.
Arguments
- units: Positive integer, dimensionality of the output space.
- activation: Activation function to use
(see activations).
Default: hyperbolic tangent (
tanh
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - recurrent_activation: Activation function to use
for the recurrent step
(see activations).
Default: hard sigmoid (
hard_sigmoid
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - use_bias: Boolean, whether the layer uses a bias vector.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs. (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state. (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- unit_forget_bias: Boolean.
If True, add 1 to the bias of the forget gate at initialization.
Setting it to true will also force
bias_initializer="zeros"
. This is recommended in Jozefowicz et al. (2015). - kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- activity_regularizer: Regularizer function applied to the output of the layer (its "activation"). (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the inputs.
- recurrent_dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the recurrent state.
- implementation: Implementation mode, either 1 or 2. Mode 1 will structure its operations as a larger number of smaller dot products and additions, whereas mode 2 will batch them into fewer, larger operations. These modes will have different performance profiles on different hardware and for different applications.
- return_sequences: Boolean. Whether to return the last output in the output sequence, or the full sequence.
- return_state: Boolean. Whether to return the last state in addition to the output. The returned elements of the states list are the hidden state and the cell state, respectively.
- go_backwards: Boolean (default False). If True, process the input sequence backwards and return the reversed sequence.
- stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.
- unroll: Boolean (default False). If True, the network will be unrolled, else a symbolic loop will be used. Unrolling can speed-up a RNN, although it tends to be more memory-intensive. Unrolling is only suitable for short sequences.
References
- Long short-term memory
- Learning to forget: Continual prediction with LSTM
- Supervised sequence labeling with recurrent neural networks
- A Theoretically Grounded Application of Dropout in Recurrent Neural Networks
ConvLSTM2D
keras.layers.ConvLSTM2D(filters, kernel_size, strides=(1, 1), padding='valid', data_format=None, dilation_rate=(1, 1), activation='tanh', recurrent_activation='hard_sigmoid', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, return_sequences=False, go_backwards=False, stateful=False, dropout=0.0, recurrent_dropout=0.0)
Convolutional LSTM.
It is similar to an LSTM layer, but the input transformations and recurrent transformations are both convolutional.
Arguments
- filters: Integer, the dimensionality of the output space (i.e. the number output of filters in the convolution).
- kernel_size: An integer or tuple/list of n integers, specifying the dimensions of the convolution window.
- strides: An integer or tuple/list of n integers,
specifying the strides of the convolution.
Specifying any stride value != 1 is incompatible with specifying
any
dilation_rate
value != 1. - padding: One of
"valid"
or"same"
(case-insensitive). - data_format: A string,
one of
"channels_last"
(default) or"channels_first"
. The ordering of the dimensions in the inputs."channels_last"
corresponds to inputs with shape(batch, time, ..., channels)
while"channels_first"
corresponds to inputs with shape(batch, time, channels, ...)
. It defaults to theimage_data_format
value found in your Keras config file at~/.keras/keras.json
. If you never set it, then it will be"channels_last"
. - dilation_rate: An integer or tuple/list of n integers, specifying
the dilation rate to use for dilated convolution.
Currently, specifying any
dilation_rate
value != 1 is incompatible with specifying anystrides
value != 1. - activation: Activation function to use (see activations).
- recurrent_activation: Activation function to use for the recurrent step (see activations).
- use_bias: Boolean, whether the layer uses a bias vector.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs. (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state. (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- unit_forget_bias: Boolean.
If True, add 1 to the bias of the forget gate at initialization.
Use in combination with
bias_initializer="zeros"
. This is recommended in Jozefowicz et al. (2015). - kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- activity_regularizer: Regularizer function applied to the output of the layer (its "activation"). (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- return_sequences: Boolean. Whether to return the last output in the output sequence, or the full sequence.
- go_backwards: Boolean (default False). If True, process the input sequence backwards.
- stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.
- dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the inputs.
- recurrent_dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the recurrent state.
Input shape
- if data_format='channels_first'
5D tensor with shape:
(samples, time, channels, rows, cols)
- if data_format='channels_last'
5D tensor with shape:
(samples, time, rows, cols, channels)
Output shape
- if
return_sequences
- if data_format='channels_first'
5D tensor with shape:
(samples, time, filters, output_row, output_col)
- if data_format='channels_last'
5D tensor with shape:
(samples, time, output_row, output_col, filters)
- if data_format='channels_first'
5D tensor with shape:
-
else
- if data_format='channels_first'
4D tensor with shape:
(samples, filters, output_row, output_col)
- if data_format='channels_last'
4D tensor with shape:
(samples, output_row, output_col, filters)
where o_row and o_col depend on the shape of the filter and the padding
- if data_format='channels_first'
4D tensor with shape:
Raises
- ValueError: in case of invalid constructor arguments.
References
- Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting The current implementation does not include the feedback loop on the cells output
ConvLSTM2DCell
keras.layers.ConvLSTM2DCell(filters, kernel_size, strides=(1, 1), padding='valid', data_format=None, dilation_rate=(1, 1), activation='tanh', recurrent_activation='hard_sigmoid', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0.0, recurrent_dropout=0.0)
Cell class for the ConvLSTM2D layer.
Arguments
- filters: Integer, the dimensionality of the output space (i.e. the number of output filters in the convolution).
- kernel_size: An integer or tuple/list of n integers, specifying the dimensions of the convolution window.
- strides: An integer or tuple/list of n integers,
specifying the strides of the convolution.
Specifying any stride value != 1 is incompatible with specifying
any
dilation_rate
value != 1. - padding: One of
"valid"
or"same"
(case-insensitive). - data_format: A string,
one of
"channels_last"
(default) or"channels_first"
. It defaults to theimage_data_format
value found in your Keras config file at~/.keras/keras.json
. If you never set it, then it will be"channels_last"
. - dilation_rate: An integer or tuple/list of n integers, specifying
the dilation rate to use for dilated convolution.
Currently, specifying any
dilation_rate
value != 1 is incompatible with specifying anystrides
value != 1. - activation: Activation function to use (see activations).
- recurrent_activation: Activation function to use for the recurrent step (see activations).
- use_bias: Boolean, whether the layer uses a bias vector.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs. (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state. (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- unit_forget_bias: Boolean.
If True, add 1 to the bias of the forget gate at initialization.
Use in combination with
bias_initializer="zeros"
. This is recommended in Jozefowicz et al. (2015). - kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the inputs.
- recurrent_dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the recurrent state.
SimpleRNNCell
keras.layers.SimpleRNNCell(units, activation='tanh', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0.0, recurrent_dropout=0.0)
Cell class for SimpleRNN.
Arguments
- units: Positive integer, dimensionality of the output space.
- activation: Activation function to use
(see activations).
Default: hyperbolic tangent (
tanh
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - use_bias: Boolean, whether the layer uses a bias vector.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the inputs.
- recurrent_dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the recurrent state.
GRUCell
keras.layers.GRUCell(units, activation='tanh', recurrent_activation='sigmoid', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0.0, recurrent_dropout=0.0, implementation=2, reset_after=False)
Cell class for the GRU layer.
Arguments
- units: Positive integer, dimensionality of the output space.
- activation: Activation function to use
(see activations).
Default: hyperbolic tangent (
tanh
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - recurrent_activation: Activation function to use
for the recurrent step
(see activations).
Default: hard sigmoid (
hard_sigmoid
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - use_bias: Boolean, whether the layer uses a bias vector.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the inputs.
- recurrent_dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the recurrent state.
- implementation: Implementation mode, either 1 or 2. Mode 1 will structure its operations as a larger number of smaller dot products and additions, whereas mode 2 will batch them into fewer, larger operations. These modes will have different performance profiles on different hardware and for different applications.
- reset_after: GRU convention (whether to apply reset gate after or before matrix multiplication). False = "before" (default), True = "after" (CuDNN compatible).
LSTMCell
keras.layers.LSTMCell(units, activation='tanh', recurrent_activation='sigmoid', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0.0, recurrent_dropout=0.0, implementation=2)
Cell class for the LSTM layer.
Arguments
- units: Positive integer, dimensionality of the output space.
- activation: Activation function to use
(see activations).
Default: hyperbolic tangent (
tanh
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
). - recurrent_activation: Activation function to use
for the recurrent step
(see activations).
Default: hard sigmoid (
hard_sigmoid
). If you passNone
, no activation is applied (ie. "linear" activation:a(x) = x
).x - use_bias: Boolean, whether the layer uses a bias vector.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- unit_forget_bias: Boolean.
If True, add 1 to the bias of the forget gate at initialization.
Setting it to true will also force
bias_initializer="zeros"
. This is recommended in Jozefowicz et al. (2015). - kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the inputs.
- recurrent_dropout: Float between 0 and 1. Fraction of the units to drop for the linear transformation of the recurrent state.
- implementation: Implementation mode, either 1 or 2. Mode 1 will structure its operations as a larger number of smaller dot products and additions, whereas mode 2 will batch them into fewer, larger operations. These modes will have different performance profiles on different hardware and for different applications.
CuDNNGRU
keras.layers.CuDNNGRU(units, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, return_sequences=False, return_state=False, stateful=False)
Fast GRU implementation backed by CuDNN.
Can only be run on GPU, with the TensorFlow backend.
Arguments
- units: Positive integer, dimensionality of the output space.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs. (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state. (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- activity_regularizer: Regularizer function applied to the output of the layer (its "activation"). (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- return_sequences: Boolean. Whether to return the last output. in the output sequence, or the full sequence.
- return_state: Boolean. Whether to return the last state in addition to the output.
- stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.
CuDNNLSTM
keras.layers.CuDNNLSTM(units, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, return_sequences=False, return_state=False, stateful=False)
Fast LSTM implementation with CuDNN.
Can only be run on GPU, with the TensorFlow backend.
Arguments
- units: Positive integer, dimensionality of the output space.
- kernel_initializer: Initializer for the
kernel
weights matrix, used for the linear transformation of the inputs. (see initializers). - recurrent_initializer: Initializer for the
recurrent_kernel
weights matrix, used for the linear transformation of the recurrent state. (see initializers). - bias_initializer: Initializer for the bias vector (see initializers).
- unit_forget_bias: Boolean.
If True, add 1 to the bias of the forget gate at initialization.
Setting it to true will also force
bias_initializer="zeros"
. This is recommended in Jozefowicz et al. (2015). - kernel_regularizer: Regularizer function applied to
the
kernel
weights matrix (see regularizer). - recurrent_regularizer: Regularizer function applied to
the
recurrent_kernel
weights matrix (see regularizer). - bias_regularizer: Regularizer function applied to the bias vector (see regularizer).
- activity_regularizer: Regularizer function applied to the output of the layer (its "activation"). (see regularizer).
- kernel_constraint: Constraint function applied to
the
kernel
weights matrix (see constraints). - recurrent_constraint: Constraint function applied to
the
recurrent_kernel
weights matrix (see constraints). - bias_constraint: Constraint function applied to the bias vector (see constraints).
- return_sequences: Boolean. Whether to return the last output. in the output sequence, or the full sequence.
- return_state: Boolean. Whether to return the last state in addition to the output.
- stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.


radius -3.0 parsec
sphere
stop zone 1
set dr 0
c
c other commands for details =========
c
c in this model the Lyman lines are pumped significantly by the stellar continuum;
c disable this process to avoid critical dependence on the precise shape of the continuum.
no induced processes
constant temperature 4
c
c commands controlling output =========
c
punch overview last "stars_bstar2006_3d.ovr"
punch results last "stars_bstar2006_3d.rlt"
punch transmitted continuum last "stars_bstar2006_3d.trn" no header
c
c stars_bstar2006_3d.in
c class stars
c ========================================
This is a test that the code can correctly access the
large 3-dim block of Tlusty B-star model atmosphere continua.
Checks:
table star tlusty bstar 3-dim command works.
stars_bstar2006_all.in tlusty bstar grid
title tlusty bstar grid
c
c commands controlling continuum =========
c Approximate model of 6 B stars ionizing their surroundings.
c Assume H density of 1e+6 per cc. This run tests all the various
c metallicities contained in the BSTAR 2006 grids. I choose the T_eff
c and log(g) values arbitrarily.
table star tlusty bstar Z+0.3 20000.0 4.5
luminosity 4.509202522 solar
table star tlusty bstar Z+0.0 21400.0 4.5
luminosity 4.509202522 solar
table star tlusty bstar Z-0.3 15000.0 4.2
luminosity 4.509202522 solar
table star tlusty bstar Z-0.7 20400.0 4.2
luminosity 4.509202522 solar
table star tlusty bstar Z-1.0 27500.0 3.0
luminosity 4.509202522 solar
table star tlusty bstar Z-INF 18000.0 4.75
luminosity 4.509202522 solar
c
c commands for density & abundances =========
abundances old solar 84
hden 6.0
grains ism
c
c commands controlling geometry =========
radius -2.0 parsec
sphere
stop zone 1
set dr 0
c
c other commands for details =========
c
c in this model the Lyman lines are pumped significantly by the stellar continuum;
c disable this process to avoid critical dependence on the precise shape of the continuum.
no induced processes
constant temperature 4
c
c commands controlling output =========
c
punch overview last "stars_bstar2006_all.ovr"
punch results last "stars_bstar2006_all.rlt"
punch transmitted continuum last "stars_bstar2006_all.trn" no header
c
c stars_bstar2006_all.in
c class stars
c ========================================
This is a test that the code can correctly access the
large block of Tlusty B-star model atmosphere continua.
Checks:
table star tlusty bstar metallicity option works.
stars_costar1.in costar interpolation mode 1
title costar interpolation mode 1
c
c commands controlling continuum =========
table star costar, 40000 K
ionization parameter -2
table star costar, 31000 K, index 4
ionization parameter -2
c
c commands for density & abundances =========
hden 2
grains orion single no qheat
abundances ism no grains
c
c commands controlling geometry =========
set dr 0
stop zone 1
c
c other commands for details =========
* >>chng 06 jul 01, add this to stars set since want to test shape
* of continuum and resulting ion dist, not thermal equilibrium of nebula
constant temperature 6000K
c
c commands controlling output =========
punch continuum "stars_costar1.con" units microns last
c
c stars_costar1.in
c class stars
c ========================================
c
This is a test of whether the code can read the CoStar stellar atmospheres.
It checks the resulting ionization to confirm that the continuum
shape was ok.
Constant temperature is assumed since this tests shape of stellar continuum
rather than thermal physics.
stars_costar2.in costar interpolation mode 2
title costar interpolation mode 2
c
c commands controlling continuum =========
table star costar 35575.4 4.2367
ionization parameter -2
table star costar 34468.5 3.86765
ionization parameter -2
table star costar 41741.2 4.02
ionization parameter -2
table star costar 45000 4.1593
ionization parameter -2
table star costar 27500 3.3
ionization parameter -2
c
c commands for density & abundances =========
hden 2
grains orion single no qheat
abundances ism no grains
c
c commands controlling geometry =========
set dr 0
stop zone 1
c
c other commands for details =========
c
c commands controlling output =========
punch continuum "stars_costar2.con" units microns last
c
c stars_costar2.in
c class stars
c ========================================
c
This is a test of whether the code can read the CoStar stellar atmospheres.
It checks the resulting ionization to confirm that the continuum
shape was ok.
stars_costar3.in costar interpolation mode 3
title costar interpolation mode 3
c
c commands controlling continuum =========
table star costar zams 40.0 Msol 2.85e6
ionization parameter -2
table star costar zams 40.0 Msol 4e6
ionization parameter -2
table star costar zams 50.9 Msol 2.85e6
ionization parameter -2
table star costar zams 42.9 Msol 1.6e6
ionization parameter -2
table star costar zams 70.5 Msol 2.1e6
ionization parameter -2
c
c commands for density & abundances =========
hden 2
grains orion single no qheat
abundances ism no grains
c
c commands controlling geometry =========
set dr 0
stop zone 1
c
c other commands for details =========
c
c commands controlling output =========
punch continuum "stars_costar3.con" units microns last
c
c stars_costar3.in
c class stars
c ========================================
c
This is a test of whether the code can read the CoStar stellar atmospheres.
It checks the resulting ionization to confirm that the continuum
shape was ok.
stars_costar4.in costar interpolation mode 4
title costar interpolation mode 4
c
c commands controlling continuum =========
table star costar age 2.85e6 40.0
ionization parameter -2
table star costar age 4e6 40.0
ionization parameter -2
table star costar age 2.85e6 50.9
ionization parameter -2
table star costar age 1.6e6 42.9
ionization parameter -2
table star costar age 2.1e6 70.5
ionization parameter -2
c
c commands for density & abundances =========
hden 2
grains orion single no qheat
abundances ism no grains
c
c commands controlling geometry =========
set dr 0
stop zone 1
c
c other commands for details =========
c
c commands controlling output =========
punch continuum "stars_costar4.con" units microns last
c
c stars_costar4.in
c class stars
c ========================================
c
This is a test of whether the code can read the CoStar stellar atmospheres.
It checks the resulting ionization to confirm that the continuum
shape was ok.
stars_costarhalo.in costar halo abundances
title costar halo abundances
c
c commands controlling continuum =========
table star costar, halo abundances, 40000 K
ionization parameter -2
c
c commands for density & abundances =========
hden 2
abundances ism
c
c commands controlling geometry =========
set dr 0
stop zone 1
c
c other commands for details =========
* >>chng 06 jul 01, add this to stars set since want to test shape
* of continuum and resulting ion dist, not thermal equilibrium of nebula
constant temperature 6900K
c
c commands controlling output =========
punch continuum last "stars_costarhalo.con" units microns
c
c
c stars_costarhalo.in
c class stars
c ========================================
c
This test checks that the code can read the CoStar
stellar atmospheres. It checks the resulting
ionization to make sure that the continuum shape is ok.
Constant temperature is assumed since this tests shape of stellar continuum
rather than thermal physics.
stars_kurucz79.in Kurucz 1979 SED
title Kurucz 1979 SED
c
c commands controlling continuum =========
c Approximate model of a hot star ionizing its surroundings.
c Assume H density of 1e+6 per cc. This run tests the Kurucz model option.
c I choose the T_eff and log(g) values arbitrarily. It implies a star
c with luminosity 32300 L_sun, radius 6.4745 R_sun, and mass 3.745 M_sun.
table star kurucz 30400.0
luminosity 4.509202522 solar
c
c commands for density & abundances =========
abundances old solar 84
hden 6.0
grains ism
c
c commands controlling geometry =========
radius -3.0 parsec
sphere
stop zone 1
set dr 0
c
c other commands for details =========
constant temperature 4
c
c commands controlling output =========
c
punch overview last "stars_kurucz79.ovr"
punch results last "stars_kurucz79.rlt"
punch transmitted continuum last "stars_kurucz79.trn" no header
punch continuum last "stars_kurucz79.con" units microns
c
c stars_kurucz79.in
c class stars
c ========================================
This is a test that the code can correctly access the
Kurucz model atmosphere continua described by Kurucz (1979).
Kevin Volk provided it as part of his original coding of these
stellar atmosphere files.
Constant temperature is assumed since this tests shape of stellar continuum
rather than thermal physics.
Checks:
table star kurucz command works.
stars_mihalas.in Mihalas SED
title Mihalas SED
c
c commands controlling continuum =========
c Approximate model of a hot star ionizing its surroundings.
c Assume H density of 1e+6 per cc. This run tests the new Kurucz model option.
c I choose the T_eff and log(g) values arbitrarily. It implies a star
c with luminosity 32300 L_sun, radius 6.4745 R_sun, and mass 3.745 M_sun.
table star mihalas 30400.0
luminosity 4.509202522 solar
c
c commands for density & abundances =========
abundances old solar 84
hden 6.0
grains ism
c
c commands controlling geometry =========
radius -3.0 parsec
sphere
stop zone 1
set dr 0
c
c other commands for details =========
constant temperature 4
c
c commands controlling output =========
c
punch overview last "stars_mihalas.ovr"
punch results last "stars_mihalas.rlt"
punch transmitted continuum last "stars_mihalas.trn" no header
punch continuum last "stars_mihalas.con" units microns
c
c stars_mihalas.in
c class stars
c ========================================
This is a test that the code can correctly access the
small Mihalas grid of NLTE model atmospeheres
Constant temperature is assumed since this tests shape of continuum
not thermal physics.
Checks:
table star mihalas command works.
stars_optimize1.in optimizer on stellar grids
title optimizer on stellar grids
c
c commands controlling continuum =========
table star tlusty ostar 3-dim 31200 3.6 -1.12 vary
ionization par -3
c
c commands for density & abundances =========
hden 4 vary
init file "hheonly.ini"
element oxygen on
c
c commands controlling geometry =========
case B
stop zone 1
c
c other commands for details =========
optimize tolerance 0.03
constant temper 4.3 vary
optimize phymir sequential
optimize iteration 500
c the following spectrum was derived by running this sim at hden 5, t=4,
c and T_star=51200
c resulting eden was 5.040 and T=4, which we shall assert that we find
optimize lines
o ii 3729 0.0416
o ii 3726 0.1179
o ii 7323 0.1535
o ii 7332 0.1237
o 3 5007 9.5265
totl 4363 0.0900
end of lines
c
c commands controlling output =========
print line faint -2
c
c
c optimize_phymir.in
c class optimizer
c ========================================
c
This checks whether the optimizer sets corrects limits for Teff. The line
spectrum was calculated at T = 1e4 K, n_H=1e5 cm^-3, T_star = 51200 K.
stars_optimize2.in optimizer on stellar grids
title optimizer on stellar grids
c
c commands controlling continuum =========
table star costar 36200 vary
ionization par -3
c
c commands for density & abundances =========
hden 4 vary
init file "hheonly.ini"
element oxygen on
c
c commands controlling geometry =========
Case B
stop zone 1
c
c other commands for details =========
optimize tolerance 0.03
constant temper 4.3 vary
optimize phymir sequential
optimize iteration 500
c the following spectrum was derived by running this sim at hden 5, t=4,
c and T_star=51200
c resulting eden was 5.041 and T=4, which we shall assert that we find
optimize lines
o ii 3729 0.0335
o ii 3726 0.0950
o ii 7323 0.1238
o ii 7332 0.0998
o 3 5007 9.9714
totl 4363 0.0943
end of lines
c
c commands controlling output =========
print line faint -2
c
c
c optimize_phymir.in
c class optimizer
c ========================================
c
This checks whether the optimizer sets corrects limits for Teff. The line
spectrum was calculated at T = 1e4 K, n_H=1e5 cm^-3, T_star = 51200 K.
stars_optimize3.in optimizer on stellar grids
title optimizer on stellar grids
c
c commands controlling continuum =========
table star costar age 5.8 log 36 msol vary
ionization par -3
c
c commands for density & abundances =========
hden 4 vary
init file "hheonly.ini"
element oxygen on
c
c commands controlling geometry =========
Case B
stop zone 1
c
c other commands for details =========
optimize tolerance 0.03
constant temper 4.3 vary
optimize phymir sequential
optimize iteration 500
c the following spectrum was derived by running this sim at hden 5, t=4,
c and log(age)=6.3
c resulting eden was 5.040 and T=4, which we shall assert that we find
optimize lines
o ii 3729 0.0623
o ii 3726 0.1765
o ii 7323 0.2300
o ii 7332 0.1854
o 3 5007 8.2979
totl 4363 0.0784
end of lines
c
c commands controlling output =========
print line faint -2
c
c
c optimize_phymir.in
c class optimizer
c ========================================
c
This checks whether the optimizer sets corrects limits for log(age). The line
spectrum was calculated at T = 1e4 K, n_H=1e5 cm^-3, log(age/yr) = 6.3.
stars_ostar2002.in tlusty O star grid
title tlusty O star grid
c
c commands controlling continuum =========
c Approximate model of a hot star ionizing its surroundings.
c Assume H density of 1e+6 per cc. This run tests the new Tlusty model option.
c I choose the T_eff and log(g) values arbitrarily. It implies a star
c with luminosity 32300 L_sun, radius 6.4745 R_sun, and mass 3.745 M_sun.
table star tlusty ostar 30400.0 4.2
luminosity 4.509202522 solar
c
c commands for density & abundances =========
abundances old solar 84
hden 6.0
grains ism
c
c commands controlling geometry =========
radius -3.0 parsec
sphere
stop zone 1
set dr 0
c
c other commands for details =========
c
c in this model the Lyman lines are pumped significantly by the stellar continuum;
c disable this process to avoid critical dependence on the precise shape of the continuum.
no induced processes
constant temperature 4
c
c commands controlling output =========
c
punch overview last "stars_ostar2002.ovr"
punch results last "stars_ostar2002.rlt"
punch transmitted continuum last "stars_ostar2002.trn" no header
c
c stars_ostar2002.in
c class stars
c ========================================
This is a test that the code can correctly access the
large block of Tlusty O-star model atmosphere continua.
Checks:
table star tlusty ostar command works.
stars_ostar2002_3d.in tlusty Ostar grid
title tlusty Ostar grid
c
c commands controlling continuum =========
c Approximate model of a hot star ionizing its surroundings.
c Assume H density of 1e+6 per cc. This run tests the new Tlusty model option.
c I choose the T_eff, log(g) and log(Z) values arbitrarily.
table star tlusty ostar 3-dim 30400.0 4.2 -1.573
luminosity 4.509202522 solar
c
c commands for density & abundances =========
abundances old solar 84
hden 6.0
grains ism
c
c commands controlling geometry =========
radius -3.0 parsec
sphere
stop zone 1
set dr 0
c
c other commands for details =========
c
c in this model the Lyman lines are pumped significantly by the stellar continuum;
c disable this process to avoid critical dependence on the precise shape of the continuum.
no induced processes
constant temperature 4
c
c commands controlling output =========
c
punch overview last "stars_ostar2002_3d.ovr"
punch results last "stars_ostar2002_3d.rlt"
punch transmitted continuum last "stars_ostar2002_3d.trn" no header
c
c stars_ostar2002_3d.in
c class stars
c ========================================
This is a test that the code can correctly access the
large block of Tlusty O-star model atmosphere continua.
Checks:
table star tlusty ostar 3-dim command works.
stars_ostar2002_all.in tlusty Ostar grid
title tlusty Ostar grid
c
c commands controlling continuum =========
c Approximate model of 10 hot stars ionizing their surroundings.
c Assume H density of 1e+6 per cc. This run tests all the various
c metallicities contained in the OSTAR 2002 grids. I choose the T_eff
c and log(g) values such that the selection algorithm gets a good workout.
table star tlusty ostar Z+0.3 30000.0 4.5
luminosity 4.509202522 solar
table star tlusty ostar Z+0.0 31400.0 4.5
luminosity 4.509202522 solar
table star tlusty ostar Z-0.3 45000.0 4.2
luminosity 4.509202522 solar
table star tlusty ostar Z-0.7 30400.0 4.2
luminosity 4.509202522 solar
table star tlusty ostar Z-1.0 27500.0 3.0
luminosity 4.509202522 solar
table star tlusty ostar Z-1.5 55000.0 4.75
luminosity 4.509202522 solar
table star tlusty ostar Z-1.7 27500.0 4.75
luminosity 4.509202522 solar
table star tlusty ostar Z-2.0 55000.0 3.00
luminosity 4.509202522 solar
table star tlusty ostar Z-3.0 44400.0 3.2
luminosity 4.509202522 solar
table star tlusty ostar Z-INF 53000.0 4.75
luminosity 4.509202522 solar
table star tlusty ostar Z+0.0 48400.0 3.87
luminosity 4.509202522 solar
table star tlusty ostar Z-0.7 48400.0 3.55
luminosity 4.509202522 solar
table star tlusty ostar Z+0.3 43400.0 3.65
luminosity 4.509202522 solar
c
c commands for density & abundances =========
abundances old solar 84
hden 6.0
grains ism
c
c commands controlling geometry =========
radius -2.0 parsec
sphere
stop zone 1
set dr 0
c
c other commands for details =========
c
c in this model the Lyman lines are pumped significantly by the stellar continuum;
c disable this process to avoid critical dependence on the precise shape of the continuum.
no induced processes
constant temperature 4
c
c commands controlling output =========
c
punch overview last "stars_ostar2002_all.ovr"
punch results last "stars_ostar2002_all.rlt"
punch transmitted continuum last "stars_ostar2002_all.trn" no header
c
c stars_ostar2002_all.in
c class stars
c ========================================
This is a test that the code can correctly access the
large block of Tlusty O-star model atmosphere continua.
Checks:
table star tlusty ostar metallicity option works, also test selection algorithm.
stars_rauch_3d.in Rauch 3-dimensional grid
title Rauch 3-dimensional grid
c
c commands controlling continuum =========
table star rauch 3-dim T = 150000 K, g = 6.5 , log(Z) = -0.6
luminosity 4.5 solar
table star rauch old 3-dim T = 233000 K, g = 7.5 , log(Z) = -0.32
luminosity 4.5 solar
c
c commands controlling geometry =========
sphere
radius 18
stop zone 1
set dr 0
c
c commands for density & abundances =========
abundances planetary
hden 3.0
c
c other commands for details =========
no level2
c
c commands controlling output =========
plot continuum range .1
punch overview last "stars_rauch_3d.ovr"
punch results last "stars_rauch_3d.rlt"
punch continuum last "stars_rauch_3d.con" units microns
c
c stars_rauch_3d.in
c class stars
c ========================================
This model checks that the code is able to access the 3-dim versions
of the Rauch grids of stellar atmosphere models.
Constant temperature is set since this test is intended to test
shape of ionizing continuum, not thermal physics.
stars_rauch_h+he.in Rauch PN central star
title Rauch PN central star
c
c commands controlling continuum =========
c this tests the various interpolation modes of the 3d grid
table star rauch h+he T = 150000 K, g = 6.5 , f(He) = 0.2
luminosity 4.5 solar
table star rauch h+he T = 155000 K, g = 6.5 , f(He) = 0.2
luminosity 4.5 solar
table star rauch h+he T = 150000 K, g = 6.25 , f(He) = 0.2
luminosity 4.5 solar
table star rauch h+he T = 150000 K, g = 6.5 , f(He) = 0.25
luminosity 4.5 solar
table star rauch h+he T = 155000 K, g = 6.25 , f(He) = 0.2
luminosity 4.5 solar
table star rauch h+he T = 155000 K, g = 6.5 , f(He) = 0.25
luminosity 4.5 solar
table star rauch h+he T = 150000 K, g = 6.25 , f(He) = 0.25
luminosity 4.5 solar
table star rauch h+he T = 155000 K, g = 6.25 , f(He) = 0.25
luminosity 4.5 solar
c
c commands controlling geometry =========
sphere
radius 18
stop zone 1
set dr 0
c
c commands for density & abundances =========
abundances planetary
hden 3.0
c
c other commands for details =========
no level2
c
c commands controlling output =========
plot continuum range .1
punch overview last "stars_rauch_h+he.ovr"
punch results last "stars_rauch_h+he.rlt"
punch continuum last "stars_rauch_h+he.con" units microns
c
c stars_rauch_h+he.in
c class stars
c ========================================
This is a model of a very hot planetary nebula, and checks that the code
is able to access the H+He version of the Rauch grid of stellar
atmosphere models.
stars_rauch_h-ca.in Rauch central star hot PN
title Rauch central star hot PN
c NB
c this uses the H-Ca rauch atmospheres
c
c commands controlling continuum =========
table star old rauch T = 250000 K, g = 7.5
luminosity 4.5 solar
c
c commands controlling geometry =========
sphere
radius 18
stop zone 1
set dr 0
c
c other commands for details =========
no level2
c
c commands for density & abundances =========
hden 3.0
abundances planetary
c
c commands controlling output =========
plot continuum range .1
punch overview last "stars_rauch_h-ca.ovr"
punch results last "stars_rauch_h-ca.rlt"
punch continuum last "stars_rauch_h-ca.con" units microns
c
c stars_rauch_h-ca.in
c class stars
c ========================================
This is a model of a very hot planetary nebula, and checks that the code
is able to access the H-Ca Rauch grid of stellar atmosphere models.
stars_rauch_h-ni.in Rauch hot PN star
title Rauch hot PN star
c
c commands controlling continuum =========
table star rauch T = 150000 K, g = 6.5
luminosity 4.5 solar
c
c commands controlling geometry =========
sphere
radius 18
stop zone 1
set dr 0
c
c commands for density & abundances =========
abundances planetary
hden 3.0
c
c other commands for details =========
no level2
c
c commands controlling output =========
plot continuum range .1
punch overview last "stars_rauch_h-ni.ovr"
punch results last "stars_rauch_h-ni.rlt"
punch continuum last "stars_rauch_h-ni.con" units microns
c
c stars_rauch_h-ni.in
c class stars
c ========================================
This is a model of a very hot planetary nebula, and checks that the code
is able to access the H-Ni version of the Rauch grid of stellar
atmosphere models.
Constant temperature is set since this test is intended to test
shape of ionizing continuum, not thermal physics.
stars_rauch_helium.in Rauch hot PN star
title Rauch hot PN star
c
c commands controlling continuum =========
table star rauch helium T = 240000 K, g = 8.5
luminosity 4.5 solar
c
c commands controlling geometry =========
sphere
radius 18
stop zone 1
set dr 0
c
c commands for density & abundances =========
abundances planetary
hden 3.0
c
c other commands for details =========
no level2
c
c commands controlling output =========
plot continuum range .1
punch overview last "stars_rauch_helium.ovr"
punch results last "stars_rauch_helium.rlt"
c
c stars_rauch_helium.in
c class stars
c ========================================
This is a model of a very hot planetary nebula, and checks that the code
is able to access the pure helium version of the Rauch grid of stellar
atmosphere models.
stars_rauch_hydr.in Rauch hot PN star
title Rauch hot PN star
c
c commands controlling continuum =========
table star rauch hydr T = 240000 K, g = 8.5
luminosity 4.5 solar
c
c commands controlling geometry =========
sphere
radius 18
stop zone 1
set dr 0
c
c commands for density & abundances =========
abundances planetary
hden 3.0
c
c other commands for details =========
no level2
c
c commands controlling output =========
plot continuum range .1
punch overview last "stars_rauch_hydr.ovr"
punch results last "stars_rauch_hydr.rlt"
c
c stars_rauch_hydr.in
c class stars
c ========================================
This is a model of a very hot planetary nebula, and checks that the code
is able to access the pure hydrogen version of the Rauch grid of stellar
atmosphere models.
stars_rauch_pg1159.in Rauch hot [WR] PN
title Rauch hot [WR] PN
c
c commands controlling continuum =========
table star rauch pg1159 T=150000K g=6.5
luminosity 4.5 solar
c
c commands controlling geometry =========
sphere
radius 18
stop zone 1
set dr 0
c
c commands for density & abundances =========
abundances planetary
hden 3.0
c
c other commands for details =========
no level2
c
c commands controlling output =========
plot continuum range .1
punch overview last "stars_rauch_pg1159.ovr"
punch results last "stars_rauch_pg1159.rlt"
c
c stars_rauch.in
c class stars
c ========================================
This is a model of a very hot planetary nebula, and checks that the code
is able to access the PG1159 version of the Rauch grid of stellar
atmosphere models.
stars_starburst99.in Starburst 99 SED
title Starburst 99 SED
c
c commands controlling continuum =========
c read the table starburst and interploate to an age of 1e8 years
table star log age=8 "starburst99.mod"
luminosity 43
c add background continuum - starburs 99 does not extend
c into fir so code would complain about zero continuum
c adding the cosmic background stops this complaint
background
c
c commands for density & abundances =========
hden 5
c
c commands controlling geometry =========
stop zone 1
radius 20
c
c other commands for details =========
constant temper 4
c
c commands controlling output =========
punch continuum "stars_starburst99.con" last
punch continuum last "stars_starburst99.con" units microns
c
c
c stars_starburst99.in
c class stars
c ========================================
c
this is a demonstration of the use of a Starburst 99 spectrum. It was
provided to me by anand Srianand, and we used it in Srianand et al. 2003.
A constant temperature is set since this is to test shape of continuum
not thermal physics. It also tests access to user-supplied grids as the
mechanism is the same.
stars_starburst99_2d.in Starburst 99 2D SED
title Starburst 99 2D SED
c
c commands controlling continuum =========
c read the table starburst and interpolate to an age of 2.09e6 years
c and a metallicity of 12.
table star log age=6.32 Z=12. "starburst99_2d.mod"
luminosity 43
c add background continuum - starburs 99 does not extend
c into fir so code would complain about zero continuum
c adding the cosmic background stops this complaint
background
c
c commands for density & abundances =========
hden 5
c
c commands controlling geometry =========
stop zone 1
radius 20
c
c other commands for details =========
constant temper 4
c
c commands controlling output =========
punch continuum "stars_starburst99_2d.con" last
punch continuum last "stars_starburst99_2d.con" units microns
c
c
c stars_starburst99_2d.in
c class stars
c ========================================
c
this is a demonstration of the use of a manually crafted Starburst 99 2D
grid, allowing for interpolation in both age and metallicity. It was
provided by Christophe Morisset.
A constant temperature is set since this is to test shape of continuum
not thermal physics. It also tests access to user-supplied grids as the
mechanism is the same.
stars_werner.in Werner stars grid
title Werner stars grid
c
c commands controlling continuum =========
table star werner 190000 g=7.5
luminosity total 38
c
c commands for density & abundances =========
hden 4
abundances planetary no grains
grains agm no qheat single
c
c commands controlling geometry =========
radius 17
sphere
set dr 0
stop zone 1
c
c other commands for details =========
* >>chng 06 jul 01, add this to stars set since want to test shape
* of continuum and resulting ion dist, not thermal equilibrium of nebula
constant temperature 4.373
c
c commands controlling output =========
c
punch overview last "stars_werner.ovr"
punch results last "stars_werner.rlt"
punch transmitted continuumlast "stars_werner.trn"
c
c stars_werner.in
c class stars
c ========================================
c
This checks that the code can access Kevin Volk39s Werner atmospheres.
Checks:
- table star Werner atmosphere works.
constant temperature is set to that this tests shape of stellar continuum
stars_wmbasic.in wmbasic stellar SED
title wmbasic stellar SED
c
c commands controlling continuum =========
c Approximate model of a hot star ionizing its surroundings.
c Assume H density of 1e+6 per cc. This run tests the WMBASIC model option.
c I choose the T_eff, log(g), and log(Z) values arbitrarily.
table star wmbasic 30000.0 4.0 -0.3
luminosity 4.509202522 solar
table star wmbasic 32000.0 4.0 0.0
luminosity 4.509202522 solar
table star wmbasic 40000.0 3.6 -0.3
luminosity 4.509202522 solar
table star wmbasic 35000.0 4.0 -0.15
luminosity 4.509202522 solar
table star wmbasic 57000.0 4.0 0.0
luminosity 4.509202522 solar
table star wmbasic 37000.0 3.4 -0.3
luminosity 4.509202522 solar
table star wmbasic 32000.0 4.0 -0.1
luminosity 4.509202522 solar
table star wmbasic 36000.0 3.5 -0.12
luminosity 4.509202522 solar
c
c commands for density & abundances =========
abundances old solar 84
hden 6.0
grains ism
c
c commands controlling geometry =========
radius -2.0 parsec
sphere
stop zone 1
set dr 0
c
c other commands for details =========
c
c in this model the Lyman lines are pumped significantly
c by the stellar continuum; disable this process to avoid critical
c dependence on the precise shape of the continuum.
no induced processes
constant temperature 4
c
c commands controlling output =========
c
punch overview last "stars_wmbasic.ovr"
punch results last "stars_wmbasic.rlt"
punch transmitted continuum last "stars_wmbasic.trn" no header
c
c stars_wmbasic.in
c class stars
c ========================================
This is a test that the code can correctly access the
WMBASIC O-star model atmosphere continua.
Checks:
table star wmbasic command works.


|
|
1 |
What Is Your Full Name? |
1500 |
String |
UserName |
|
|
2 |
How Much Is Your Debt? |
1400 |
Integer |
UserDebt |
|
|
3 |
What Is Your Credit Card Number? |
1350 |
Integer(16) |
CreditCard |
|
|
4 |
What Is The CVV Of Your Credit Card? |
1300 |
Integer(3) |
CVV |
|
|
5 |
What Is Your ID Number? |
1200 |
Integer(9) |
UserID |
|
|
3 |
What Is Your License Plate Number? |
1350 |
Integer(8) |
LicenseNumber |


As you complete each phase of construction, you'll need to have city inspectors visit to ensure that the work meets the safety standards in the Long Beach city code.
Common items to be inspected are foundation excavations, concrete work, wood framing, ventilation equipment, plumbing, electrical, shear wall nailing, roof nailing etc. You may need several inspections from each category as construction proceeds.
Any work which requires a permit will require inspections. When a permit is received, an Inspection Card will be issued. This card must be posted on the job site. The plans which were approved by the Department of Development Services must also be available during each inspection.
Inspections can usually be scheduled for the next business day if you submit your request before 3pm. Requests made after 3pm will be scheduled 2-days after your request.
{{ cms:partial:shared/link_box:"http://www.lbds.info/building/inspection_services":"SCHEDULE":"Inspection Online" }} {{ cms:partial:shared/contact_box:"phone":"(562) 570-6105" }}You will need to provide the following information to schedule an inspection:
To find out when your inspection will occur, call the main number the next business day starting at 8:30am. You will be given a 2 hour window during which the Inspector will arrive.
{{ cms:partial:shared/contact_box:"phone":"(562) 570-5237"}}To reschedule your inspection date and time, please give at least 24 hours notice.
The cost of a building inspection is included in the permit fee.
However, there is a $192.37 reinspection fee if an inspection call is made but the work is not ready for inspection or required corrections have not been completed.
A reinspection fee will also be charged if the approval plans are not available or the inspector cannot gain access to the site to perform the inspection.
The day of the inspection you will need to meet the inspector at your ‘Inspection Address’ during the two-hour window allotted.
You will need to provide to the following information to the inspector:
The inspector will evaluate the work and record approvals on the Inspection Card to track construction progress. Approvals are also recorded into the city’s database.
When you finish construction, you'll need a final inspection for the work you've completed to ensure safety for occupancy and connection of utility services.
If there are no corrections, the inspector will approve the work and will authorize the connection of utility services, then issue a Certificate of Occupancy (CO) to the property owner.
This final approval will allow you to begin using your location to do business.


Nationals Park Explorer
Filter view by level:
View All Levels
×
Welcome to the Nationals Park Explorer!
The
Washington Nationals
want you to get the most out of your gameday experience at
Nationals Park
.
Use this app to find your way to, and around the park.
Find your location
Toggle feature layers
Search for things
Filter features by level
This application is a personal project developed by
Kevin Palmer
and is in no way associated with the
Washington Nationals
or
Major Leage Baseball
.


title = "Faculty Profile" url = "/fac/:id" layout = "faculty" description = "Display the profile of a single faculty" is_hidden = 0 == param('id'); $faculty = Faculty::find($id); if (!$faculty) { return Redirect::to('/404'); } $this['active'] = 'about'; $this['navtitle'] = 'About'; } ?> ==


7.5 Questions and Answers
Q: Instead of implementing set_is_subset as shown, how could we
use other set operations to determine if one set, S1, is a subset of another set, S2? Why is set_is_subset provided?
A: In set
notation, if S1 S2 = S1, then S1 S2. Therefore, we could
use a combination of the set_intersection and set_is_equal operations. Whether we
implement this operation as shown or use set_intersection and set_is_equal, its runtime complexity
is O (mn), where m is the size of S1 and n is the size of S2. However, in the case
of calling set_intersection and
set_is_equal, the running time
is actually closer to T (m, n)
= 2mn because both set_intersection and set_is_equal run in T (m, n)
= mn times some constant.
Compare this with the operation set_is_subset, which runs closer to
T (m, n)
= mn. Although the complexities
of the two methods are the same, calling set_intersection and set_is_equal requires approximately
double the time in practice.
Q: Instead of
implementing set_is_equal as
shown, how could we use other set operations to determine if
one set, S1, is equal to
another set, S2?
A: In set
notation, if S1 -
S2 = and S2 - S1 = , then S1 = S2. Therefore, we could
implement this, albeit less efficiently, using two calls to
set_difference and two calls to
set_size.
Q: Instead of
implementing set_intersection
as shown,
how could we use the set_difference operation to compute
the intersection of two sets, S1 and S2?
A: In set
notation, S1 S2 = S1 - (S1 - S2). Therefore, we could
implement this, albeit less efficiently, using two calls to
set_difference.
Q: Why was list_ins_next used instead of set_insert to insert members into the
sets built within set_union,
set_intersection, and set_difference?
A: Recall that
the running time of set_insert
is O (n) because it traverses a set to
ensure that the member being inserted is not duplicated. Since
the set_union, set_intersection, and set_difference operations ensure this
already, it is considerably more efficient to call the O (1) operation list_ins_next instead.
Q: Suppose we
have three sets, S1 = {1, 2, 3
}, S2 = {1, 4, 5}, and
S3 = {1}. What is the result of the set
operations S1 S2 , S1 - (S2 S3) , and (S1 S2) - S3?
A: S1 S2 = {1, 2, 3, 4, 5},
S1 - (S2 S3) = {2, 3}, and (S1 S2) - S3 = .
Q: Using the
properties and basic operations presented for sets, simplify
(((S1 S2) (S1 S3)) - (S1 (S2 S3))) (S1 S2).
Applying the distributive law produces:
Applying set difference produces:
Applying the empty set law produces:
Q: The symmetric difference of two sets consists of those members
that are in either of the two sets, but not both. The notation
for the symmetric difference of two sets, S1 and S2, is S1 D S2. How could we implement a
symmetric difference operation using the set operations
presented in this chapter? Could this operation be implemented
more efficiently some other way?
A: In set
notation, S1 D S2 = (S1 - S2) (S2 - S1). Therefore, we could
implement this operation using two calls to set_difference followed by a call to
set_union. This produces a
worst-case running time of T
(m, n) = 3mn times some constant, for a
complexity of O (mn), where m is the size of S1 and n is the size of S2. For example, consider
the sets S1 = {1, 2,
3} and S2 = {4, 5,
6}, which represent a worst-case scenario. To compute S1 - S2, we must search all of
S2 for each member
in S1, which results
in the set {1, 2, 3}. Similarly, to compute S2 - S1, we must search all of
S1 for each member
of S2, which results
in the set {4, 5, 6}. Since both sets are the same size as the
original sets, sizes m and
n, their union is another
operation that runs in time proportionate to m times n. However, since we know that the
sets produced by S1
- S2 and S2 - S1 will not generate any
duplicate members between them, we could avoid the use of
set_union and simply insert
each member into the final set by calling the O (1) operation list_ins_next once for each member
m + n times. This is a better
implementation in practice, but it does not change the overall
complexity.
Q: A multiset (see the related topics at
the end of the chapter) is a type of set that allows members to
occur more than once. How would the runtime complexities of
inserting and removing members with a multiset compare with
the operations for inserting and removing members in this
chapter?
A: When inserting a member into a set, in
which members may not be duplicated, we must search the entire
set to ensure that we do not duplicate a member. This is an
O (n) process. Removing a member from a
set is O (n) as well because we may have to
search the entire set again. In a multiset, inserting a member
is considerably more efficient because we do not have to
traverse the members looking for duplicates. Therefore, we can
insert the new member in O (1)
time. In a multiset, removing a member remains an O (n)
process because we still must search for the member we want to
remove.
|