MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / build

Method build

tensorflow/contrib/rnn/python/ops/rnn_cell.py:1518–1543  ·  view source on GitHub ↗
(self, inputs_shape)

Source from the content-addressed store, hash-verified

1516 return self._output_size
1517
1518 def build(self, inputs_shape):
1519 input_size = tensor_shape.dimension_value(
1520 tensor_shape.TensorShape(inputs_shape).with_rank(2)[1])
1521 if input_size is None:
1522 raise ValueError("Could not infer input size from inputs.get_shape()[-1]")
1523
1524 num_proj = self._num_units if self._num_proj is None else self._num_proj
1525
1526 # Variables for the NAS cell. `recurrent_kernel` is all matrices multiplying
1527 # the hiddenstate and `kernel` is all matrices multiplying the inputs.
1528 self.recurrent_kernel = self.add_variable(
1529 "recurrent_kernel", [num_proj, self._NAS_BASE * self._num_units])
1530 self.kernel = self.add_variable(
1531 "kernel", [input_size, self._NAS_BASE * self._num_units])
1532
1533 if self._use_bias:
1534 self.bias = self.add_variable("bias",
1535 shape=[self._NAS_BASE * self._num_units],
1536 initializer=init_ops.zeros_initializer)
1537
1538 # Projection layer if specified
1539 if self._num_proj is not None:
1540 self.projection_weights = self.add_variable(
1541 "projection_weights", [self._num_units, self._num_proj])
1542
1543 self.built = True
1544
1545 def call(self, inputs, state):
1546 """Run one step of NAS Cell.

Callers

nothing calls this directly

Calls 2

with_rankMethod · 0.80
add_variableMethod · 0.45

Tested by

no test coverage detected