Sha256: 10504d102c31dc210b0f9901e665b9ff0931ed2bdd82a05a1b07a41baef33288

Contents?: true

Size: 406 Bytes

Versions: 1

Compression:

Stored size: 406 Bytes

Contents

module TensorFlow
  module Keras
    module Metrics
      class Mean
        def update_state(values)
          input = TensorFlow.convert_to_tensor(values, dtype: :float)
          @total = Math.reduce_sum(input)
          @count = RawOps.size(input: input)
        end

        def result
          RawOps.div_no_nan(x: @total, y: TensorFlow.cast(@count, :float))
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tensorflow-0.1.2 lib/tensorflow/keras/metrics/mean.rb