1122cdce33e3e0a01a7f82645617317530aa571fbA. Unique TensorFlower# Copyright 2016 The TensorFlow Authors. All Rights Reserved. 2a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# 3a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# Licensed under the Apache License, Version 2.0 (the "License"); 4a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# you may not use this file except in compliance with the License. 5a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# You may obtain a copy of the License at 6a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# 7a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# http://www.apache.org/licenses/LICENSE-2.0 8a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# 9a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# Unless required by applicable law or agreed to in writing, software 10a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# distributed under the License is distributed on an "AS IS" BASIS, 11a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# See the License for the specific language governing permissions and 13a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# limitations under the License. 14a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower# ============================================================================== 15a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower"""Wrappers for bucketization operations.""" 16a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlowerfrom __future__ import absolute_import 17a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlowerfrom __future__ import division 18a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlowerfrom __future__ import print_function 19a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower 2065283e269fac1306089303143daf550b7b1a6658A. Unique TensorFlowerfrom tensorflow.python.ops import math_ops 21a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower 22a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower 23a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlowerdef bucketize(input_tensor, boundaries, name=None): 24a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower """Bucketizes input_tensor by given boundaries. 25a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower 26a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower See bucketize_op.cc for more details. 27a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower 28a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower Args: 2985eeec0d415a1478bbeffc3d4545c795bee64e9fJonathan Hseu input_tensor: A `Tensor` which will be bucketize. 30a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower boundaries: A list of floats gives the boundaries. It has to be sorted. 31a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower name: A name prefix for the returned tensors (optional). 32a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower 33a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower Returns: 3485eeec0d415a1478bbeffc3d4545c795bee64e9fJonathan Hseu A `Tensor` with type int32 which indicates the corresponding bucket for 35a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower each value in `input_tensor`. 36a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower 37a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower Raises: 38a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower TypeError: If boundaries is not a list. 39a5f1772bdc7992ac1a5bce94723744d2fe37fd68A. Unique TensorFlower """ 4065283e269fac1306089303143daf550b7b1a6658A. Unique TensorFlower return math_ops._bucketize( # pylint: disable=protected-access 4165283e269fac1306089303143daf550b7b1a6658A. Unique TensorFlower input_tensor, boundaries=boundaries, name=name) 42