def _top_k(probabilities, targets):
targets = math_ops.to_int32(targets)
if targets.get_shape().ndims > 1:
- targets = array_ops.squeeze(targets, squeeze_dims=[1])
+ targets = array_ops.squeeze(targets, axis=[1])
return metric_ops.streaming_mean(nn.in_top_k(probabilities, targets, k))
return _top_k
def _squeeze_and_onehot(targets, depth):
- targets = array_ops.squeeze(targets, squeeze_dims=[1])
+ targets = array_ops.squeeze(targets, axis=[1])
return array_ops.one_hot(math_ops.to_int32(targets), depth)
# There is always one activation per instance by definition, so squeeze
# away the extra dimension.
- return array_ops.squeeze(nn_activations, squeeze_dims=[1])
+ return array_ops.squeeze(nn_activations, axis=[1])
class FlattenedFullyConnectedLayer(hybrid_layer.HybridLayer):
mask = math_ops.less(
r, array_ops.ones_like(r) * self.params.bagging_fraction)
gather_indices = array_ops.squeeze(
- array_ops.where(mask), squeeze_dims=[1])
+ array_ops.where(mask), axis=[1])
# TODO(thomaswc): Calculate out-of-bag data and labels, and store
# them for use in calculating statistics later.
tree_data = array_ops.gather(processed_dense_features, gather_indices)