Class: TensorStream::NN

Inherits:
Object
  • Object
show all
Defined in:
lib/tensor_stream/nn/nn_ops.rb

Overview

High level machine learning functions

Class Method Summary collapse

Class Method Details

.relu(features, name: nil) ⇒ Object



8
9
10
# File 'lib/tensor_stream/nn/nn_ops.rb', line 8

def self.relu(features, name: nil)
  TensorStream.max(features, 0, name: "relu_#{name}")
end

.softmax(logits, _options = {}) ⇒ Object



4
5
6
# File 'lib/tensor_stream/nn/nn_ops.rb', line 4

def self.softmax(logits, _options = {})
  TensorStream.exp(logits) / TensorStream.reduce_sum(TensorStream.exp(logits))
end