Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
haifeng-jin committed Jul 26, 2019
1 parent 32ecda6 commit 5374ede
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 137 deletions.
2 changes: 1 addition & 1 deletion autokeras/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from autokeras.auto_model import GraphAutoModel
from autokeras.const import Constant
from autokeras.hypermodel.block import ConvBlock
from autokeras.hypermodel.hyperblock import ImageBlock
from autokeras.hypermodel.block import DenseBlock
from autokeras.hypermodel.block import EmbeddingBlock
from autokeras.hypermodel.composite import ImageBlock
from autokeras.hypermodel.block import Merge
from autokeras.hypermodel.block import ResNetBlock
from autokeras.hypermodel.block import RNNBlock
Expand Down
2 changes: 1 addition & 1 deletion autokeras/auto_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _label_encoding(self, y):
for temp_y, output_node in zip(y, self.outputs):
hyper_head = output_node
if isinstance(hyper_head, node.Node):
hyper_head = output_node.in_hypermodels[0]
hyper_head = output_node.in_blocks[0]
if (isinstance(hyper_head, head.ClassificationHead) and
utils.is_label(temp_y)):
label_encoder = processor.OneHotEncoder()
Expand Down
26 changes: 13 additions & 13 deletions autokeras/hypermodel/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def set_hp_value(hp, name, value):
hp.values[full_name] = value or hp.values[full_name]


class HyperBlock(kerastuner.HyperModel):
class Block(kerastuner.HyperModel):
"""The base class for different HyperBlock.
The HyperBlock can be connected together to build the search space
Expand Down Expand Up @@ -59,11 +59,11 @@ def __call__(self, inputs):
"""
self.inputs = nest.flatten(inputs)
for input_node in self.inputs:
input_node.add_out_hypermodel(self)
input_node.add_out_block(self)
self.outputs = []
for _ in range(self._num_output_node):
output_node = node.Node()
output_node.add_in_hypermodel(self)
output_node.add_in_block(self)
self.outputs.append(output_node)
return self.outputs

Expand All @@ -83,7 +83,7 @@ def clear_nodes(self):
self.outputs = None


class DenseBlock(HyperBlock):
class DenseBlock(Block):
"""HyperBlock for Dense layers.
# Arguments
Expand Down Expand Up @@ -132,7 +132,7 @@ def build(self, hp, inputs=None):
return output_node


class RNNBlock(HyperBlock):
class RNNBlock(Block):
"""An RNN HyperBlock.
# Arguments
Expand Down Expand Up @@ -201,7 +201,7 @@ def build(self, hp, inputs=None):
return output_node


class ConvBlock(HyperBlock):
class ConvBlock(Block):
"""HyperBlock for vanilla ConvNets.
# Arguments
Expand Down Expand Up @@ -270,7 +270,7 @@ def _get_padding(kernel_size, output_node):
return 'same'


class ResNetBlock(HyperBlock, resnet.HyperResNet):
class ResNetBlock(Block, resnet.HyperResNet):
"""HyperBlock for ResNet.
# Arguments
Expand Down Expand Up @@ -302,7 +302,7 @@ def build(self, hp, inputs=None):
return model.outputs


class XceptionBlock(HyperBlock, xception.HyperXception):
class XceptionBlock(Block, xception.HyperXception):
"""XceptionBlock.
An Xception structure, used for specifying your model with specific datasets.
Expand Down Expand Up @@ -364,7 +364,7 @@ def shape_compatible(shape1, shape2):
return shape1[:-1] == shape2[:-1]


class Merge(HyperBlock):
class Merge(Block):
"""Merge block to merge multiple nodes into one.
# Arguments
Expand Down Expand Up @@ -401,7 +401,7 @@ def build(self, hp, inputs=None):
return tf.keras.layers.Concatenate()(inputs)


class Flatten(HyperBlock):
class Flatten(Block):
"""Flatten the input tensor with Keras Flatten layer."""

def build(self, hp, inputs=None):
Expand All @@ -413,7 +413,7 @@ def build(self, hp, inputs=None):
return input_node


class SpatialReduction(HyperBlock):
class SpatialReduction(Block):
"""Reduce the dimension of a spatial tensor, e.g. image, to a vector.
# Arguments
Expand Down Expand Up @@ -451,7 +451,7 @@ def build(self, hp, inputs=None):
return output_node


class TemporalReduction(HyperBlock):
class TemporalReduction(Block):
"""Reduce the dimension of a temporal tensor, e.g. output of RNN, to a vector.
# Arguments
Expand Down Expand Up @@ -491,7 +491,7 @@ def build(self, hp, inputs=None):
return output_node


class EmbeddingBlock(HyperBlock):
class EmbeddingBlock(Block):
"""Word embedding block for sequences.
The input should be tokenized sequences with the same length, where each element
Expand Down

0 comments on commit 5374ede

Please sign in to comment.