Sha256: f6113d81cccca035cc3a2d6e62ba5584a2e8fdb089674a41f5aff2c956627c1c

Contents?: true

Size: 570 Bytes

Versions: 9

Compression:

Stored size: 570 Bytes

Contents

module TensorStream
  module CheckOps
    def self.included(klass)
      klass.class_eval do
        register_op :assert_equal do |context, tensor, inputs|
          result = call_vector_op(tensor, :equal, inputs[0], inputs[1], context) { |t, u| t == u }

          result = result.is_a?(Array) ? result.flatten.uniq : [result]
          prefix = tensor.options[:message] || ""
          raise TensorStream::InvalidArgumentError, "#{prefix} #{tensor.inputs[0].name} != #{tensor.inputs[1].name}" if result != [true]

          nil
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tensor_stream-1.0.9 lib/tensor_stream/evaluator/ruby/check_ops.rb
tensor_stream-1.0.8 lib/tensor_stream/evaluator/ruby/check_ops.rb
tensor_stream-1.0.7 lib/tensor_stream/evaluator/ruby/check_ops.rb
tensor_stream-1.0.6 lib/tensor_stream/evaluator/ruby/check_ops.rb
tensor_stream-1.0.5 lib/tensor_stream/evaluator/ruby/check_ops.rb
tensor_stream-1.0.4 lib/tensor_stream/evaluator/ruby/check_ops.rb
tensor_stream-1.0.3 lib/tensor_stream/evaluator/ruby/check_ops.rb
tensor_stream-1.0.2 lib/tensor_stream/evaluator/ruby/check_ops.rb
tensor_stream-1.0.1 lib/tensor_stream/evaluator/ruby/check_ops.rb