Skip to content

Instantly share code, notes, and snippets.

@jamesonthecrow
Created March 5, 2019 04:17
Show Gist options
  • Select an option

  • Save jamesonthecrow/4b07049baecf543ec0f60ea79e7a59b5 to your computer and use it in GitHub Desktop.

Select an option

Save jamesonthecrow/4b07049baecf543ec0f60ea79e7a59b5 to your computer and use it in GitHub Desktop.
# Instance Norm
inpt = keras.layers.Input(shape=(500, 500, 3))
out = keras_contrib.layers.InstanceNormalization(axis=-1)(inpt)
keras_model = keras.models.Model(inpt, out)
mlmodel = coremltools.converters.keras.convert(
keras_model,
add_custom_layers=True,
custom_conversion_functions={}
)
mlmodel.get_spec()
"""
Output:
specificationVersion: 2
description {
input {
name: "input1"
type {
multiArrayType {
shape: 3
shape: 500
shape: 500
dataType: DOUBLE
}
}
}
output {
name: "output1"
type {
multiArrayType {
shape: 3
shape: 500
shape: 500
dataType: DOUBLE
}
}
}
}
neuralNetwork {
layers {
name: "instance_normalization_2"
input: "input1"
output: "output1"
custom {
}
}
}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment