/// <summary> /// Fits the state of the preprocessing layer to the dataset. /// </summary> /// <param name="data"></param> /// <param name="reset_state"></param> public void adapt(IDatasetV2 data, bool reset_state = true) { var shape = data.output_shapes[0]; if (shape.rank == 1) { data = data.map(tensor => array_ops.expand_dims(tensor, -1)); } build(data.variant_tensor); var preprocessed_inputs = data.map(_preprocess); }
/// <summary> /// Fits the state of the preprocessing layer to the dataset. /// </summary> /// <param name="data"></param> /// <param name="reset_state"></param> public override void adapt(IDatasetV2 data, bool reset_state = true) { var shape = data.output_shapes[0]; if (shape.ndim == 1) { data = data.map(tensor => array_ops.expand_dims(tensor, -1)); } build(data.variant_tensor); var preprocessed_inputs = data.map(_preprocess); _index_lookup_layer.adapt(preprocessed_inputs); }